import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:jd_flutter/pages/cart/cart_item.dart';


class CartPage extends StatefulWidget {
  const CartPage({super.key});

  @override
  State<CartPage> createState() => _CartPageState();
}

class _CartPageState extends State<CartPage> {

  @override
  Widget build(BuildContext context) {

    ScreenUtil.init(context, designSize: const Size(750, 1334));

    return Stack(
      children: [
        ListView(
          children: const [
            CartItem(),
            CartItem(),
            CartItem(),
            CartItem(),
          ],
        ),
        Positioned(
          bottom: 0,
          width: 750.w,
          height: 78.h,
          child: Container(
            width: 750.w,
            height: 78.h,
            decoration: const BoxDecoration(
              color: Colors.white,
              border: Border(
                top: BorderSide(
                  width: 1,
                  color: Colors.black12
                )
              )
            ),
            child: Stack(
              children: [
                Align(
                  alignment: Alignment.centerLeft,
                  child: Row(
                    children: [
                      Container(
                        width: 60.w,
                        height: 78.h,
                        child: Checkbox(value: true, activeColor: Colors.pink, onChanged: (val){})
                      ),
                      const Text("全选")
                    ],
                  ),
                ),
                Align(
                  alignment: Alignment.centerRight,
                  child: Container(
                    child: ElevatedButton(
                      onPressed: () {  },
                      style: ButtonStyle(
                        backgroundColor: MaterialStateProperty.all(Colors.red)
                      ),
                      child: const Text("结算",style: TextStyle(color: Colors.white)),
                    ),
                  )
                )
              ],
            ),
          )
        )
      ],
    );
  }
}
